/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.rec.beans;

import edu.upn.sigemfi.rec.bc.AccionCobranzaDelegate;
import edu.upn.sigemfi.rec.be.AccionCobranza;

/**
 *
 * @author Diego
 */
public class AccionCobranzaController {

    private AccionCobranzaDelegate delegado;
    private AccionCobranza accionCobranza;

    public String nuevo() {
        accionCobranza = new AccionCobranza();
        return "nuevo";
    }

    public String registrar(AccionCobranza accionCobranza) {
        try {
            delegado.crear(accionCobranza);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "volver";
    }

    public String editar(AccionCobranza accionCobranza) {
        try {
            delegado.editar(accionCobranza);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "volver";
    }

    public String eliminar(AccionCobranza accionCobranza) {
        try {
            delegado.eliminar(accionCobranza);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "volver";
    }

    public AccionCobranza buscar(long codigo) {
        try {
            return delegado.buscar(codigo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
